package cn.tedu.Innerclass;

import org.junit.jupiter.api.Test;

public class TestInner2 {
    @Test
    public void test(){
        /*Outer2.Inner2 inner2=new Outer2().new Inner2();
        inner2.eat();*/
        new Outer2().getInner2Eat();
    }
}
class Outer2{
    //6提供私有内部类对象的创建和调用
    //私有内部类是外部类的属性之一
    public void getInner2Eat(){
        Inner2 inner2 = new Inner2();
        inner2.eat();
    }
    //本内部类被private修饰，外部无法创建对象
   private class Inner2{
        public void eat(){
            System.out.println("Inner...eat");
        }
    }

}
